
import { Vue, Component, Mixins } from 'vue-property-decorator'
import grayScaleMixin from '@/moduleC/mixins/grayScale'

interface Winner {
  name: string
  prize: string
}

interface Prize {
  name: string
}


interface UserInfo {
  coupons: number
  [key: string]: any
}

// Update the interface to match uni.GetSystemInfoResult
interface UniSystemInfo extends UniApp.GetSystemInfoResult {
  statusBarHeight: number
}

@Component
export default class LuckyDraw extends Mixins(grayScaleMixin) {
  // Data properties with type annotations
  private statusBarHeight: number = 0
  private navHeight: number = 0
  private wheelDeg: number = 0
  private userInfo: UserInfo = uni.getStorageSync('_UserInfo')
  private drawCount: number = 1
  private duration: number = 10

  private winners: Winner[] = [
    { name: '大婶丫头', prize: '5000元现金+5000积分' },
    { name: '赵大美', prize: '100元现金+100积分' },
    { name: '上善若水', prize: '50元现金+50积分' },
    { name: '余琏茉媛', prize: '700元现金+700积分' },
    { name: '落雪倾城', prize: '20元现金+20积分' },
    { name: '夜尚羙ゃ', prize: '100元现金+100积分' },
    { name: '德邦☆总管', prize: '300元现金+300积分' },
    { name: '唱你的歌', prize: '10元现金+10积分' },
    { name: '沧海与光', prize: '10元现金+10积分' },
    { name: '他比光暖', prize: '10元现金+10积分' },
    { name: '拢一蓑烟雨', prize: '10元现金+10积分' },
    { name: '萌面大瞎', prize: '10元现金+10积分' },
  ]

  private prizes: Prize[] = [
    { name: '谢谢参与' },
    { name: '10积分' },
    { name: '20积分' },
    { name: '30积分' },
    { name: '40积分' },
    { name: '50积分' },
    { name: '100积分' },
    { name: '特等奖' },
  ]

  onLoad(): void {
    try {
      const systemInfo = uni.getSystemInfoSync()
      if (systemInfo?.statusBarHeight) {
        this.statusBarHeight = systemInfo.statusBarHeight
        this.navHeight = systemInfo.statusBarHeight + 44
      }
    } catch (error) {
      console.error('Failed to get system info:', error)
    }
  }

  goBack(): void {
    uni.navigateBack()
  }
}